home *** CD-ROM | disk | FTP | other *** search
/ Visual FX for Image FX / VisualFX for Image FX 3 - Disc 2.iso / setup / setup01.rexx next >
OS/2 REXX Batch file  |  1997-02-11  |  10KB  |  409 lines

  1. /*
  2.                                  Visual FX
  3.                                     For
  4.                                  Image FX
  5.                                SetUp Script
  6.                            Written By J.L. White
  7.  
  8.                          (C)1997 Merlin's Software
  9.  
  10. */
  11. signal on error
  12. signal on syntax
  13.  
  14. parse arg CurrentFX VolumeNum TotalNum Frames Fields
  15. options results
  16. Quote = '22'X
  17.  
  18. address "IMAGEFX.1"
  19. ScreenToFront
  20. FlyOn = 0
  21. Compression = -1
  22. Frames = strip(Frames)
  23. Fields = strip(Fields)
  24. AddPadding = -1
  25.  
  26.  
  27.  
  28. call FXSetUp()
  29.  
  30. if exists("libs:flyer.library") then do
  31.     if (POS('PROJECT_REXX_PORT',SHOW('Ports')) =0) then do
  32.         RequestNotify 'Flyer Must Be Running First!'
  33.         exit
  34.         end
  35.     call OpenFlyStuff()
  36.     Title = "Effect #"right(CurrentFX,2,'0')" From Volume #"strip(VolumeNum)
  37.     Gadget.1 = 'I/150/18/Number of Frames:/'Frames
  38.     Gadget.2 = 'X/258/20/Use Field Rendering?/'Fields
  39.     Gadget.3 = 'D/110/40/120/ImageA Type/4/FLYER CLIP/FLYER STILL/FRAME/SEQUENCE'
  40.     Gadget.4 = 'D/110/60/120/ImageB Type/4/FLYER CLIP/FLYER STILL/FRAME/SEQUENCE'
  41.     Gadget.5 = 'D/308/50/120/Save As/2/FLYER CLIP/SEQUENCE'
  42.     Gadget.6 = 'L/135/86/1/2/'Title
  43.     ComplexRequest  '"Visual FX  SetUp Options"' 6 Gadget 450 100
  44.     if rc ~= 0 then do
  45.         call CloseStuff()
  46.         exit 0
  47.         end
  48.     else do
  49.         Frames = RESULT.1
  50.         Field = RESULT.2
  51.         IAType = RESULT.3
  52.         IBType = RESULT.4
  53.         SaveType = RESULT.5
  54.            end
  55.     end
  56. else do
  57.     Title = "Effect #"right(CurrentFX,2,'0')" From Volume #"strip(VolumeNum)
  58.     Gadget.1 = 'I/150/18/Number of Frames:/30'
  59.     Gadget.2 = 'X/280/20/Use Field Rendering?/1'
  60.     Gadget.3 = 'D/110/40/120/ImageA Type/2/FRAME/SEQUENCE'
  61.     Gadget.4 = 'D/340/40/120/ImageB Type/2/FRAME/SEQUENCE'
  62.     Gadget.5 = 'L/150/66/1/2/'Title
  63.     ComplexRequest  '"Visual FX  SetUp Options"' 5 Gadget 480 80
  64.     if rc ~= 0 then do
  65.         exit 0
  66.         end
  67.     else do
  68.         Frames = RESULT.1
  69.         Field = RESULT.2
  70.         IAType = RESULT.3+2
  71.         IBType = RESULT.4+2
  72.         SaveType = 1
  73.            end
  74. end
  75.  
  76. call GetA()
  77. call GetB()
  78. call GetS()
  79. call SaveTemp()
  80.  
  81. if FlyOn = 1 then
  82.     call CloseStuff()
  83. ScreenToBack
  84. EXIT 0
  85.  
  86.  
  87. FXSetUp:
  88.     FXSName = "VFXIFXCD:SetUp/"right(strip(VolumeNum),2,'0')"/"right(strip(CurrentFX),2,'0')".rexx"
  89.     if exists(FXSName) then do
  90.         address command "sys:rexxc/rx >NIL: "FXSName" "strip(TotalNum)".txt"
  91.         end
  92. return
  93.  
  94. YesOrNo: procedure
  95.     parse Arg Title,Yes,No
  96.     Address FLY_1 OK_TEXT Yes
  97.     Address FLY_1 CANCEL_TEXT No
  98.     Address FLY_1 AskYesNoNT Title
  99.     if result = "OK" then YesNo = 1
  100.     else YesNo = 0
  101. return YesNo
  102.  
  103. FindDrive:
  104.     address command "C:Info >RAM:DriveList"
  105.     call open TempFile,"RAM:DriveList",R
  106.     do until eof(TempFile)
  107.         line = readln(TempFile)
  108.         parse var line Drive" "Rest
  109.         if Drive = "FA0:" then 
  110.             FlyVolume = word(Rest,7)":"
  111.     end
  112.     call close TempFile
  113.     address command "Delete >NIL: RAM:DriveList"
  114. return FlyVolume
  115.  
  116.  
  117. OpenFlyStuff:
  118.     FlyOn = 1
  119.     address command "run VFXIFXCD:FLY" 
  120.     do while (POS('FLY_1',SHOW('Ports')) = 0)
  121.         address command "wait 1"
  122.         end
  123.     TOASTERLIB="ToasterARexx.port"
  124.     call remlib('ToasterARexx.port')
  125.     call remlib('PROJECT_REXX_PORT')
  126.     call addlib('PROJECT_REXX_PORT' , 0)
  127.     call addlib(TOASTERLIB,0)
  128.     DriveName = FindDrive()
  129. return
  130.  
  131.  
  132. GetFile:
  133.     parse Arg Title, Path
  134.     Address FLY_1 SetString Path
  135.     Address FLY_1 GetFileNameNT Title
  136. return result
  137.  
  138.  
  139. GetA:
  140.  if IAType = 0 then do
  141.     call Switcher(TOSW)
  142.     PicAName = GetFile("Select Flyer Clip For ImageA!  ",DriveName)
  143.     Name = GetFileName(PicAName)
  144.     if Name = "" then do
  145.         Address FLY_1 OK_TEXT " OK "
  146.         Title = "You Must Enter A Valid Clip Name To Use!"
  147.         Address FLY_1 FYINT Title
  148.         Address FLY_1 Quit
  149.         call Switcher(TOWB)
  150.         exit
  151.         end
  152.     Address FLY_1 SetFileName PicAName
  153.     Address FLY_1 GetClipLength PicAName
  154.     End = result
  155.     Start = (End+2) - Frames
  156.     Address FLY_1 Program "5"
  157.     Address FLY_1 StartNum Start
  158.     Address FLY_1 EndNum End
  159.     Address FLY_1 CurrentNum "-1"
  160.     FTitle = "(Default Is Last "Frames" Frames)"
  161.     Address FLY_1 GetTimeNT "Select Frame To Start With For ImageA!\"center(FTitle,38,' ')
  162.     StartA = ((word(result,1))*2)
  163.     End = word(result,2)
  164.     call addlib('PROJECT_REXX_PORT' , 0)
  165.     call addlib(TOASTERLIB,0)
  166.     call Switcher(TOWB)
  167.     address command "C:Wait 1"
  168.     ScreenToFront
  169.     end
  170.    if IAType = 1 then do
  171.     RequestFile '"Select Flyer Still For ImageA!"' DriveName ' '
  172.     PicAName = result
  173.     Name = GetFileName(PicAName)
  174.     if Name = "" then do
  175.         Title = "You Must Enter A Valid Name To Use!"
  176.         RequestNotify Title
  177.         if FlyOn = 1 then Address FLY_1 Quit
  178.         exit
  179.         end
  180.     StartA = 0
  181.     end
  182.    if IAType = 2 then do
  183.     RequestFile '"Select FileName For ImageA!"' 'SYS:' ' '
  184.     PicAName = result
  185.     Name = GetFileName(PicAName)
  186.     if Name = "" then do
  187.         Title = "You Must Enter A Valid Name To Use!"
  188.         RequestNotify Title
  189.         if FlyOn = 1 then Address FLY_1 Quit
  190.         exit
  191.         end
  192.     StartA = 0
  193.     end
  194.    if IAType = 3 then do
  195.     RequestFile '"Select BaseName For ImageA! "' 'SYS:' ' '
  196.     PicAName = result
  197.     Name = GetFileName(PicAName)
  198.     if Name = "" then do
  199.         Title = "You Must Enter A Valid Name To Use!"
  200.         RequestNotify Title
  201.         if FlyOn = 1 then Address FLY_1 Quit
  202.         exit
  203.         end
  204.     RequestNumber '"Select Frame Number To Start With!"' 1
  205.     StartA = result-1
  206.     end
  207. return
  208.  
  209.  
  210. GetB:
  211.   if IBType = 0 then do
  212.     call Switcher(TOSW)
  213.     DriveName = GetPathName(PicAName)
  214.     PicBName = GetFile("Select Flyer Clip For ImageB!  ",DriveName)
  215.     Name = GetFileName(PicBName)
  216.     if Name = "" then do
  217.         Address FLY_1 OK_TEXT " OK "
  218.         Title = "You Must Enter A Valid Clip Name To Use!"
  219.         Address FLY_1 FYINT Title
  220.         Address FLY_1 Quit
  221.         call Switcher(TOWB)
  222.         exit
  223.         end
  224.  
  225.     Address FLY_1 SetFileName PicBName
  226.     Address FLY_1 GetClipLength PicBName
  227.     End = result
  228.     Address FLY_1 Program "5"
  229.     Address FLY_1 StartNum 0
  230.     Address FLY_1 EndNum End
  231.     Address FLY_1 CurrentNum "-1"
  232.     FTitle = "(Default Is First "Frames" Frames)"
  233.     Address FLY_1 GetTimeNT "Select Frame To Start With For ImageB!\"center(FTitle,38,' ')
  234.     StartB = ((word(result,1))*2)
  235.     End = word(result,2)
  236.     call addlib('PROJECT_REXX_PORT' , 0)
  237.     call addlib(TOASTERLIB,0)
  238.     call Switcher(TOWB)
  239.     address command "C:Wait 1"
  240.     ScreenToFront
  241.     end
  242.    if IBType = 1 then do
  243.     DriveName = GetPathName(PicAName)
  244.     RequestFile '"Select Flyer Still For ImageB!"' DriveName ' '
  245.     PicBName = result
  246.     Name = GetFileName(PicBName)
  247.     if Name = "" then do
  248.         Title = "You Must Enter A Valid Name To Use!"
  249.         RequestNotify Title
  250.         if FlyOn = 1 then Address FLY_1 Quit
  251.         exit
  252.         end
  253.     StartB = 0
  254.     end
  255.    if IBType = 2 then do
  256.     DriveName = GetPathName(PicAName)
  257.     RequestFile '"Select FileName For ImageB!"' DriveName ' '
  258.     PicBName = result
  259.     Name = GetFileName(PicBName)
  260.     if Name = "" then do
  261.         Title = "You Must Enter A Valid Name To Use!"
  262.         RequestNotify Title
  263.         if FlyOn = 1 then Address FLY_1 Quit
  264.         exit
  265.         end
  266.     StartB = 0
  267.     end
  268.    if IBType = 3 then do
  269.     DriveName = GetPathName(PicAName)
  270.     RequestFile '"Select BaseName For ImageB! "' DriveName ' '
  271.     PicBName = result
  272.     Name = GetFileName(PicBName)
  273.     if Name = "" then do
  274.         Title = "You Must Enter A Valid Name To Use!"
  275.         RequestNotify Title
  276.         if FlyOn = 1 then Address FLY_1 Quit
  277.         exit
  278.         end
  279.     RequestNumber '"Select Frame Number To Start With!"' 1
  280.     StartB = result-1
  281.     end
  282. return
  283.  
  284.  
  285. GetSName:
  286.     SaveName = GetFile("Enter Flyer Clip Name To Save!  ",DriveName)
  287.     Name = GetFileName(SaveName)
  288.     if Name = "" then do
  289.         Address FLY_1 OK_TEXT " OK "
  290.         Title = "You Must Enter A Valid Clip Name To Save!"
  291.         Address FLY_1 FYINT Title
  292.         Address FLY_1 Quit
  293.         call Switcher(TOWB)
  294.         exit
  295.         end
  296.     if exists(SaveName) then do
  297.         Answer = YesOrNo(" Are You Sure You Want To \ OverWrite "SaveName"?"," YES "," NO ")
  298.         if Answer = 0 then do
  299.             call GetSName()
  300.             return
  301.             end
  302.         Answer = YesOrNo(" Are You Positive?"," YES "," NO ")
  303.         if Answer = 1 then do
  304.             address command "Delete >NIL: "SaveName
  305.             if exists(SaveName".I") then
  306.                 address command "Delete >NIL: "SaveName".I"
  307.             end
  308.         if Answer = 0 then do
  309.             call GetSName()
  310.             return
  311.             end
  312.  
  313.         end
  314. return
  315.  
  316. GetS:
  317.   if SaveType = 0 then do
  318.     if substr(DriveName,1,1) ~= "F" then
  319.         DriveName = FindDrive()
  320.     call Switcher(TOSW)
  321.     call GetSName()
  322.     Address FLY_1 GetCompressionNT
  323.     Compression = result
  324.     if Compression = 2 then Compression = 0
  325.     Answer = YesOrNo("Do You Want To Add Padding\To Beginning & End Of Clip?"," YES "," NO ")
  326.     if Answer = 1 then do
  327.         AddPadding = GetText("Enter Number Of\ Frames To Use","30")
  328.         end
  329.     
  330.     call addlib('PROJECT_REXX_PORT' , 0)
  331.     call addlib(TOASTERLIB,0)
  332.     call Switcher(TOWB)
  333.     address command "C:Wait 1"
  334.     ScreenToFront
  335.     end
  336.    if SaveType = 1 then do
  337.     DriveName = GetPathName(PicBName)
  338.     RequestFile '"Select BaseName To Save "' DriveName ' '
  339.     SaveName = result
  340.     Name = GetFileName(SaveName)
  341.     if Name = "" then do
  342.         Title = "You Must Enter A Valid Name To Use!"
  343.         RequestNotify Title
  344.         if FlyOn = 1 then Address FLY_1 Quit
  345.         exit
  346.         end
  347.     end
  348. return
  349.  
  350. GetText:
  351.     parse Arg Title, Text
  352.     Address FLY_1 SetString Text
  353.     Address FLY_1 GetStringNT Title
  354. return result
  355.  
  356.  
  357. CloseStuff:
  358.     Address FLY_1 Quit
  359.     call remlib('ToasterARexx.port')
  360.     call remlib('PROJECT_REXX_PORT')
  361. return
  362.  
  363.  
  364. SaveTemp:
  365.     address command "Copy >NIL: VFXIFXCD:Arexx/"right(strip(VolumeNum),2,'0')"/"right(strip(CurrentFX),2,'0')".rexx to RAM:VFXTEMP"
  366.     call open TempFile,"Ram:VFXTEMP",A
  367.     call writeln TempFile,"Settings:"
  368.     call writeln TempFile,"   Compression="Compression
  369.     call writeln TempFile,"   Frames="Frames
  370.     call writeln TempFile,"   Field="Field
  371.     call writeln TempFile,"   IAType="IAType
  372.     call writeln TempFile,"   PicAName="Quote""PicAName""Quote
  373.     call writeln TempFile,"   StartA="StartA
  374.     call writeln TempFile,"   IBType="IBType
  375.     call writeln TempFile,"   PicBName="Quote""PicBName""Quote
  376.     call writeln TempFile,"   StartB="StartB
  377.     call writeln TempFile,"   SaveType="SaveType
  378.     call writeln TempFile,"   SaveName="Quote""SaveName""Quote
  379.     call writeln TempFile,"   Volume="strip(VolumeNum)
  380.     call writeln TempFile,"   CurrentFX="strip(CurrentFX)
  381.     call writeln TempFile,"   FXNum="strip(TotalNum)
  382.     call writeln TempFile,"   Padding="strip(AddPadding)
  383.     call writeln TempFile,"return"
  384.     call close TempFile
  385.  
  386. return
  387.  
  388. GetPathName: procedure  
  389.    ARG CompleteName
  390.    c = lastpos("/",CompleteName)
  391.    if c = 0 then c = lastpos(":",CompleteName)
  392.    return left(CompleteName,c)
  393.  
  394. GetFileName: procedure  
  395.    ARG CompleteName
  396.    c = lastpos("/",CompleteName)
  397.    if c = 0 then c = lastpos(":",CompleteName)
  398.    return substr(CompleteName, c + 1)
  399.  
  400.  
  401. syntax:
  402. error:
  403.     Title = "An Error Was Found With This Script On Line #"SIGL"!"
  404.     if SIGL != 35 then RequestNotify Title
  405.     if FlyOn = 1 then
  406.         Address FLY_1 Quit
  407. exit
  408.  
  409.